<?php 
	echo $this->element('reportcss');
	$file_name = "高层次人才团队统计报表";
	if(empty($report)){?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2><?php echo $file_name;?></h2>
	</div>
	
    <?php
    	$url_explode=explode("group=", $_SERVER["QUERY_STRING"]);
    	echo '<div class="right back_btn">';
		echo $html->link("导出报表","/reports/talentdeclarereport/1?group=".$url_explode[1]);
		echo '</div>';
	?> 
	<?php echo $this->element('reportgroup'); ?>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
 <?php }?>
 			<?php 
        		if(!empty($report)){
        			echo "<div align='center'><h3>$file_name</h3></div>";
        		}
        	?>
        	<table border='1'>
            	<tr>
            		<th>序号</th>
                    <th>单位名称</th>
                    <th>模块</th>
		 			<th>人才姓名</th>
		 			<th>性别</th>
		 			<th>出生年月</th>
		 			<th>国籍</th>
		 			<th>项目名称</th>
		 			<th>毕业院校</th>
		 			<th>学历学位</th>
		 			<th>注册时间</th>
		 			<th>注册资金（万元）</th>
		 			<th colspan='2'>人才项目获奖情况</th>
                </tr>
		 		<?php 
		 			$i = 1;
		 			if(!empty($companys))
		 			{
			 			foreach($companys as $company)
						{
							$j = 0;
							$cname = $company["SearchCompany"]["company_name"];//单位名称
							$groupname = $grouplist[$company["SearchCompany"]["groupid"]];
 			 				$contact = $company["SearchCompany"]["contact"];//人才姓名
			 				$sex = $company["SearchCompany"]["sex"];//性别
			 				if($sex == 0)
			 					$sex = "男";
			 				else 
			 					$sex = "女";
			 				$birthday = "";
			 				$bir = $company["SearchCompany"]["birthday"];
			 				if($bir)
			 					$birthday = date("Y.m",strtotime($bir));//出生年月
			 				$nation = $company["SearchCompany"]["nation"];//国籍
			 				$pid = $company["SearchCompany"]["pid"];
			 				classregistry::init('Project')->unbindModel(array ('hasMany' => array ('Attachment','pros_cvalue','Informationfrom','Competence'),'belongsTo' => array ('phase_cvalue','reg_cvalue','reg_decl_cvalue','first_owners','second_owners')));
			 				$pname = "";
			 				$where = "Project.id = '$pid'";
			 				$project = classregistry::init('Project')->findAll($where,"Project.project_name");
			 				if($project)
			 					$pname = $project[0]["Project"]["project_name"];//项目名称
			 				$graduate_school = $company["SearchCompany"]["graduate_school"];//毕业院校
			 				$education = "";
			 				$edu = $company["SearchCompany"]["education"];
			 				if(!empty($edu))
			 					$education = $education_array[$edu];//学历学位
			 				$reg_time = date("Y-m-d",strtotime($company["SearchCompany"]["reg_time"]));//注册时间
			 				$cap_type = $company["SearchCompany"]["cap_type"];
			 				$capital = $company["SearchCompany"]["capital"];
			 				if($cap_type == 1)
			 					$capital .= "(美元)";
			 				
			 				//人才信息
			 				$talents = $company["CompTalent"];
			 				$talents_num = count($talents);
			 				$statement = "";
			 				if($talents)
			 				{
			 					foreach($talents as $talent)
				 				{
				 					$declare_time = date("Y",strtotime($talent["declare_time"]));//申报的年份
				 					$declare_status = $talent["declarate_status"];
				 					if($declare_status == $talent_delcare_fail_id)
				 					{
				 						$beizhu = "未评上";
				 					}
				 					else
				 					{
					 					$tvalue=$talent['type_id'];
										classregistry::init('Talstack')->tname="";
										classregistry::init('Talstack')->showtname($tvalue);
										$tname=rtrim(classregistry::init('Talstack')->tname,"/");
					 					$names = explode("/",$tname);
										unset($names[0]);
										$beizhu = "";
										foreach($names as $name)
										{
											$beizhu .= $name; 
										}
				 					}
				 					
									echo "<tr>";
				 					if($j == 0)
				 					{
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($i)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($cname)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($groupname)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($contact)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($sex)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($birthday)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($nation)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($pname)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($graduate_school)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($education)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($reg_time)."</td>";
						 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatquantity($capital)."</td>";
				 					}
				 					
				 					echo "<td align='center' >".$str->formatCell($declare_time)."</td>";
				 					echo "<td align='center' >".$str->formatCell($beizhu)."</td>";
	
				 					$j++;
				 					echo "</tr>";
				 				} 
				 				$i++;
			 				}
						}
		 			}
					
		 		?>
            </table>
<?php if(empty($report)){?>
		</div>
    </div>
</div>
<?php }?>
